package cn.edu.tyu.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import cn.edu.tyu.finance.thingstype.domain.users;
import cn.edu.tyu.util.Dbutil;

public class userpDaoImpl {
	public int adduser(users Users) throws SQLException {
		Connection conn=Dbutil.getConnection();
		String sql="insert into users values(?,?,?)";
		PreparedStatement ps=conn.prepareStatement(sql);
		ps.setString(1, users.getUserid());
		ps.setString(2, users.getUsername());
		ps.setString(3, users.getUserpsw());
		int res = ps.executeUpdate();
		Dbutil.backConn(conn,ps,null);
		return res;
	}
	public static void main(String[] args) throws SQLException {
		userpDaoImpl userpDao=new userpDaoImpl();
		users users =new users();
		users.setUserid("1");
		users.setUsername("zs");
		users.setUserpsw("123456");
		int res = userpDao.adduser(users);
		System.out.println("res="+res);
	}
}

